import subAppInfo from '@/constant'

const routes = [
  {
    path: '/',
    name: 'Index',
    redirect: '/dashboard',
    component: () => import('@/layouts/main.vue'),
    meta: {
      title: '首页',
      level: 'folder'
    },
    children: [
      {
        path: 'dashboard',
        name: 'Dashboard',
        component: () => import('@/views/HomeView.vue'),
        meta: {
          title: '首页',
          level: 'menu'
        },
      },
      {
        path: 'about',
        name: 'About',
        component: () => import('@/views/AboutView.vue'),
        meta: {
          title: '关于',
          level: 'menu'
        },
      },
      {
        // path: `${subAppInfo.name}/:page*`,
        path: `${subAppInfo.devServer.base}:page*`,
        name: 'MyPage',
        component: () => import('@/views/MyPage.vue'),
        meta: {
          title: 'child/vite',
          level: 'menu',
          hidden: true
        },
      }
    ]
  },
  {
    path: '/404',
    name: 'NotFound',
    component: () => import('@/views/NotFound.vue'),
    meta: {
      hidden: true
    }
  },
  // {
  //   path: '/home',
  //   name: 'Home',
  //   component: () => import('@/views/HomeView.vue')
  // },
  // {
  //   path: '/about',
  //   name: 'About',
  //   // route level code-splitting
  //   // this generates a separate chunk (About.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import('@/views/AboutView.vue')
  // },
  // {
  //   // 👇 非严格匹配，/my-page/* 都指向 MyPage 页面
  //   path: '/my-page/:page*',
  //   name: 'MyPage',
  //   component: () => import('@/views/MyPage.vue'),
  // },
]

export default routes
